package com.qingzhuge.pay.service;

import com.github.binarywang.wxpay.bean.coupon.WxPayCouponInfoQueryResult;
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponSendResult;
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponStockQueryResult;
import com.github.binarywang.wxpay.bean.result.*;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.qingzhuge.pay.dto.PayOrderDto;
import com.qingzhuge.pay.dto.PayRefundDto;
import com.qingzhuge.pay.entity.SysPayProperty;
import com.qingzhuge.pay.entity.support.WxResult;
import com.qingzhuge.pay.vo.*;

import java.io.File;
import java.util.Date;

/**
 * @author : zero.xiao
 * @description :
 * @date : 2018/11/19 0019 下午 12:51
 * @modified :
 * @since :
 */
public interface ISysPayWxService {
    String NOTIFY_URL = "/api/open/pay/wx/notify";
    /**订单支付成功回调地址*/
    String PAY_URL = "/pay/{id}";
    /**退款成功回调地址*/
    String REFUND_URL = "/refund/{id}";
    /**扫码支付成功回调地址*/
    String SCAN_URL = "/scan/{id}";


    SysPayProperty getPayProperties(Long payId);

    WxPayOrderQueryResult queryOrder(PayOrderQuery query) throws WxPayException;

    boolean closeOrder(Long pid, Long orderId) throws WxPayException;

    <T,D extends WxResult> D createOrder(PayOrderDto order);

    WxPayUnifiedOrderResult unifiedOrder(PayOrderDto order) throws WxPayException;

    boolean refund(PayRefundDto refundDto) throws WxPayException;

    WxPayRefundQueryResult refundQuery(PayOrderRefundQuery query)
            throws WxPayException;

    String parseOrderNotifyResult(String xmlData, Long pid) throws WxPayException;

    String parseRefundNotifyResult(String xmlData, Long pid) throws WxPayException;

    String parseScanPayNotifyResult(String xmlData, Long pid) throws WxPayException;

    WxPaySendRedpackResult sendRedpack(PaySendRedpack redpack) throws WxPayException;

    WxPayRedpackQueryResult queryRedpack(String mchBillNo, Long pid) throws WxPayException;

    byte[] createScanPayQrcodeMode1(String productId, File logoFile, Integer sideLength, Long pid);

    String createScanPayQrcodeMode1(String productId, Long pid);

    byte[] createScanPayQrcodeMode2(String codeUrl, File logoFile, Integer sideLength, Long pid);

    void report(PayReport report) throws WxPayException;

    WxPayBillResult downloadBill(PayDownloadBill bill) throws WxPayException;

    WxPayMicropayResult micropay(PayMicropay micropay) throws WxPayException;

    WxPayOrderReverseResult reverseOrder(PayOrderReverse reverse) throws WxPayException;

    String getSandboxSignKey(Long pid) throws WxPayException;

    WxPayCouponSendResult sendCoupon(PayCouponSend couponSend)
            throws WxPayException;

    WxPayCouponStockQueryResult queryCouponStock(PayCoupon coupon)
            throws WxPayException;

    WxPayCouponInfoQueryResult queryCouponInfo(PayCouponInfoQuery query)
            throws WxPayException;

    String queryComment(Date beginDate, Date endDate, Integer offset, Integer limit, Long pid) throws WxPayException;
}
